package com.naxiang.cn.naxiangstram;

import android.Manifest;
import android.content.Intent;
import android.os.Build;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;

import com.tbruyelle.rxpermissions2.RxPermissions;

import io.reactivex.functions.Consumer;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        new RxPermissions(this)
                .request(Manifest.permission.CAMERA,
                        Manifest.permission.RECORD_AUDIO,
                        Manifest.permission.WRITE_EXTERNAL_STORAGE)
                .subscribe(new Consumer<Boolean>() {
                    @Override
                    public void accept(@NonNull Boolean aBoolean) throws Exception {
                        if (!aBoolean) {
                            finish();
                        }
                    }
                });

    }

    //打开直播
    public void livevido(View view) {
        startActivity(new Intent(MainActivity.this,NaxiangVido.class));

    }
    //
    public void updatstream(View view) {
        startActivity(new Intent(MainActivity.this,OldStream.class));
    }

    public void localfile(View view) {
        startActivity(new Intent(MainActivity.this,LocationUpLoad.class));
    }
}
